Skip to content

fix: improve Dockerfile signal handling and slim runtime#117

Draft
tac0turtle wants to merge 1 commit intomainfrom
fix/dockerfile-shutdown-improvements
Draft

fix: improve Dockerfile signal handling and slim runtime#117
tac0turtle wants to merge 1 commit intomainfrom
fix/dockerfile-shutdown-improvements

Conversation

@tac0turtle
Copy link
Contributor

  • Use SIGINT stop signal for proper graceful shutdown
  • Remove unnecessary build/debug packages from runtime image (libssl-dev, pkg-config, strace)
  • Bump healthcheck start-period to 60s

Description

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Performance improvement
  • Refactoring

Related Issues

Fixes #(issue)

Checklist

  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published

Testing

Additional Notes

- Use SIGINT stop signal for proper graceful shutdown
- Remove unnecessary build/debug packages from runtime image
  (libssl-dev, pkg-config, strace)
- Bump healthcheck start-period to 60s

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @tac0turtle, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request focuses on enhancing the Docker image for the 'ev-reth' application by optimizing its runtime environment and improving container lifecycle management. The changes aim to create a leaner, more robust container that handles shutdowns gracefully and provides a more forgiving startup period for its health checks.

Highlights

  • Runtime Image Optimization: Removed development and debugging packages (libssl-dev, pkg-config, strace) from the Docker runtime image to reduce its size and attack surface.
  • Graceful Shutdown: Configured the Dockerfile to use SIGINT as the stop signal, enabling a more graceful shutdown process for the application within the container.
  • Healthcheck Configuration: Increased the start-period for the container's healthcheck from 40 seconds to 60 seconds, providing more time for the application to initialize before health checks begin.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • Dockerfile
    • Removed 'libssl-dev', 'pkg-config', and 'strace' packages from the runtime image to reduce its footprint.
    • Updated the 'HEALTHCHECK' 'start-period' from 40 seconds to 60 seconds.
    • Added 'STOPSIGNAL SIGINT' to ensure proper signal handling for graceful container termination.
Activity
  • No specific activity (comments, reviews, etc.) was provided in the context for this pull request.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@claude
Copy link

claude bot commented Feb 6, 2026

Claude finished @tac0turtle's task —— View job


Pull Request Review

Todo List:

  • Read and analyze the Dockerfile changes
  • Review code quality and best practices
  • Check for potential bugs or issues
  • Evaluate performance considerations
  • Assess security concerns
  • Consider test coverage implications

Review Findings

Code Quality and Best Practices ✅

The changes follow Docker best practices well:

  1. Signal Handling: Adding STOPSIGNAL SIGINT (line 71) is excellent - this ensures the application receives proper shutdown signals for graceful termination instead of SIGKILL.

  2. Runtime Image Optimization: Removing build/debug packages from the runtime image is a solid practice:

    • Removed: libssl-dev, pkg-config, strace
    • Kept: Essential runtime dependencies (ca-certificates, curl, jq, tini)
  3. Healthcheck Tuning: Increasing start-period from 40s to 60s (line 68) gives the application more time to initialize before health checks begin.

Potential Issues ⚠️

Minor concern with package removal:

  • Verify that libssl-dev removal doesn't break SSL/TLS functionality. The runtime should use libssl3 (installed with ca-certificates) but worth testing.
  • Removing strace eliminates debugging capabilities in production - this is generally good but consider if you need debugging tools.

Performance Considerations 🚀

Positive impacts:

  • Image Size: Removing unnecessary packages reduces image size and attack surface
  • Startup: More generous healthcheck start-period reduces false negatives during startup
  • Shutdown: SIGINT allows proper resource cleanup vs force-kill

No performance regressions expected from these changes.

Security Concerns 🔒

Security improvements:

  • Reduced Attack Surface: Removing dev packages (libssl-dev, pkg-config, strace) eliminates potential vulnerability vectors
  • Proper Signal Handling: SIGINT allows graceful shutdown and proper resource cleanup
  • Minimal Runtime: Only essential packages remain in final image

No security concerns identified - these changes improve the security posture.

Test Coverage Considerations 🧪

Recommendations for testing:

  • Test container startup/shutdown cycles to verify SIGINT handling works correctly
  • Verify SSL/TLS connections still work after removing libssl-dev
  • Confirm healthcheck behaves properly with new 60s start-period
  • Test that the application still functions normally without the removed debug packages

Note: No automated tests exist in the repository for Docker functionality, but the changes are low-risk and follow established best practices.

Summary

This is a well-crafted improvement that enhances the Docker image's:

  • Security posture (reduced attack surface)
  • Operational robustness (proper signal handling)
  • Resource efficiency (smaller image size)
  • Reliability (better healthcheck timing)

The changes are minimal, focused, and follow Docker best practices. All requested review areas have been covered with no blocking issues identified.

Recommendation: ✅ Approve - These are solid improvements with no significant risks.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request improves the Dockerfile by slimming the runtime image and improving signal handling. The changes are good, removing unnecessary build-time packages and setting the stop signal for graceful shutdown. I've added a couple of suggestions to further improve the Dockerfile: one to make the runtime image even smaller by avoiding recommended package installations, and another to make the healthcheck more robust by checking a live service endpoint instead of just the binary's existence. These changes will improve the container's efficiency and reliability.


RUN apt-get update && \
apt-get install -y ca-certificates curl jq libssl-dev pkg-config strace tini && \
apt-get install -y ca-certificates curl jq tini && \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

To further reduce the image size, it's a good practice to use the --no-install-recommends flag with apt-get install. This prevents the installation of packages that are not strictly required for the main packages to run, contributing to a slimmer runtime image.

    apt-get install -y --no-install-recommends ca-certificates curl jq tini && \

Comment on lines +68 to 69
HEALTHCHECK --interval=30s --timeout=3s --start-period=60s --retries=3 \
CMD /usr/local/bin/ev-reth --version || exit 1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The current healthcheck command only verifies that the binary is executable, not that the node service is actually running and healthy. This could lead to a situation where the container is considered healthy even if the node has crashed or is unresponsive. A more effective healthcheck would query a live service endpoint, such as the JSON-RPC API, to confirm the service is responsive.

HEALTHCHECK --interval=30s --timeout=3s --start-period=60s --retries=3 \
    CMD curl -f -X POST --data '{"jsonrpc":"2.0","method":"eth_syncing","params":[],"id":1}' -H "Content-Type: application/json" http://localhost:8545 || exit 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant